// 续签合同
<template>
  <div class="contractRenew">
    <div class="title">续签记录</div>
    <el-table :data="tableData" style="width: 100%" :row-style="tableRowStyle">
      <el-table-column prop="createName" label="操作人" width="300" align="left" />
      <el-table-column prop="signDate" label="合同签订日期" width="300" align="left" />
      <el-table-column prop="signType" label="签订方式" width="300" align="left">
        <template slot-scope="scope">{{scope.row.signType | dict('rent_signing_method')}}</template>
      </el-table-column>
      <el-table-column prop="contractCode" width="300" label="合同编码" align="left" />
      <el-table-column width="100" label="操作" align="left">
        <template slot-scope="scope">
          <el-button type="text" v-if="scope.row.rentContractId!=rentContractId" @click="view(scope.row)">查看</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { getRenewList } from '../../api/rent-contract.js'

export default {
  name: 'contractRenew',
  data () {
    return {
      rentContractId: "",
      tableData: [],
    }
  },

  methods: {
    //加载列表
    loadRenewList (contractId) {
      let rentContractId = contractId;
      this.rentContractId = rentContractId;
      let category = 1
      getRenewList(rentContractId, category)
        .then(response => {
          if (response.data.code == 0) {
            this.tableData = response.data.data;
          } else {
            this.$alert("加载变更记录服务端服务错误" + response.code);
          }
        }
        )
    },

    view (row) {
      this.$parent.$parent.$parent.$parent.show(row.rentContractId);
      this.$parent.$parent.$parent.$parent.activeName = "first";
    },

    tableRowStyle (scope) {
      if (scope.row.rentContractId == this.rentContractId) {
        return { backgroundColor: "yellow" }
      }
    }
  }

}
</script>

<style lang="scss" scoped>
.contractRenew {
  .title {
    font-size: 16px;
    font-weight: bold;
    margin: 10px 0 20px;
    color: #333;
  }

  /deep/ .el-table {
    .el-table__header {
      border-color: #dee2e6;
    }

    thead th {
      background-color: #fafafa;
      color: #333;
    }

    td {
      padding: 10px 0;
    }
  }
}
</style>
